﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace BullTasDesaDal.Entities
{
    public class Betterment
    {
        public virtual Int64 Id { get; set; }
        public virtual Analysis Analysis { get; set; }
        public virtual string Name { get; set; }
        public virtual string MeasureUnit { get; set; }
        public virtual int Value { get; set; }
        public virtual decimal Quantity { get; set; }
        public virtual DateTime DateCreate { get; set; }
        public virtual string UserCreate { get; set; }
        public virtual string Type { get; set; }

        public virtual string QuantityString 
        {
            get { return Quantity.ToString(CultureInfo.InvariantCulture.NumberFormat); } 
        }

        public virtual decimal Total
        {
            get { return (Value * Quantity); }
        }

        public override bool Equals(object obj)
        {
            if (this == obj) return true;
            Betterment betterment = obj as Betterment;
            if (betterment == null) return false;
            return Id == (betterment.Id + betterment.Analysis.Id);
        }

        public override int GetHashCode()
        {
            return Id.GetHashCode();
        }
    }
}
